package top.asteam;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.SpringBootVersion;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * @Author Rock Wang
 * @Time 2021/4/11
 */
@Slf4j
@SpringBootApplication
@EnableDiscoveryClient
public class ZKOrderConsumerMain80 {

    public static void main(String[] args) throws UnknownHostException {
        ConfigurableApplicationContext applicationContext = SpringApplication.run(ZKOrderConsumerMain80.class, args);

        Environment env = applicationContext.getEnvironment();
        String ip = InetAddress.getLocalHost().getHostAddress();
        String port = env.getProperty("server.port");
        String path = env.getProperty("server.servlet.context-path");
        String version = SpringBootVersion.getVersion();
        log.info("\n ________      ___    ___ ________  _________  _______   ________  ________  ________  ________  ___           ________  ________  _____ ______      \n" +
                "|\\   __  \\    |\\  \\  /  /|\\   ____\\|\\___   ___\\\\  ___ \\ |\\   __  \\|\\   __  \\|\\   __  \\|\\   __  \\|\\  \\         |\\   ____\\|\\   __  \\|\\   _ \\  _   \\    \n" +
                "\\ \\  \\|\\  \\   \\ \\  \\/  / | \\  \\___|\\|___ \\  \\_\\ \\   __/|\\ \\  \\|\\  \\ \\  \\|\\  \\ \\  \\|\\  \\ \\  \\|\\  \\ \\  \\        \\ \\  \\___|\\ \\  \\|\\  \\ \\  \\\\\\__\\ \\  \\   \n" +
                " \\ \\  \\\\\\  \\   \\ \\    / / \\ \\_____  \\   \\ \\  \\ \\ \\  \\_|/_\\ \\   _  _\\ \\   ____\\ \\  \\\\\\  \\ \\  \\\\\\  \\ \\  \\        \\ \\  \\    \\ \\  \\\\\\  \\ \\  \\\\|__| \\  \\  \n" +
                "  \\ \\  \\\\\\  \\   \\/  /  /   \\|____|\\  \\   \\ \\  \\ \\ \\  \\_|\\ \\ \\  \\\\  \\\\ \\  \\___|\\ \\  \\\\\\  \\ \\  \\\\\\  \\ \\  \\____  __\\ \\  \\____\\ \\  \\\\\\  \\ \\  \\    \\ \\  \\ \n" +
                "   \\ \\_______\\__/  / /       ____\\_\\  \\   \\ \\__\\ \\ \\_______\\ \\__\\\\ _\\\\ \\__\\    \\ \\_______\\ \\_______\\ \\_______\\\\__\\ \\_______\\ \\_______\\ \\__\\    \\ \\__\\\n" +
                "    \\|_______|\\___/ /       |\\_________\\   \\|__|  \\|_______|\\|__|\\|__|\\|__|     \\|_______|\\|_______|\\|_______\\|__|\\|_______|\\|_______|\\|__|     \\|__|\n" +
                "             \\|___|/        \\|_________|                                                                                                             \n");
        log.info("\n----------------------------------------------------------\n\t" +
                "Spring Boot Version : " + version + "\n\t"+
                "Application  is running! " + " Access URLs:\n\t" +
                "Local访问网址: \t\thttp://localhost:" + port + path + "\n\t" +
                "External访问网址: \thttp://" + ip + ":" + port + path + "\n\t" +
                "----------------------------------------------------------");
    }

}
